//
//  ConActivityDetailController.m
//  Shengzhuli
//
//  Created by FXGuo on 2017/4/18.
//  Copyright © 2017年 kamangkeji. All rights reserved.
//

#import "ConActivityDetailController.h"
#import "ActivityNetService.h"

@interface ConActivityDetailController ()<UIWebViewDelegate>

@property (nonatomic,weak) UIWebView *web;

@end

@implementation ConActivityDetailController

- (void)viewDidLoad {
    [super viewDidLoad];
    UIWebView *web = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, ScreenW, ScreenH-64)];
    web.delegate = self;
    self.web = web;
    [self.view addSubview:web];
    if (self.type == WebTypeActivityDetail) {
        self.title = @"活动报名";
        [web loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/app/html/activityDetail?id=%zd",PublicServer,self.ID]]]];
    }else if (self.type == WebTypeRegister){
        self.title = @"注册协议";
        [web loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/member/loginAgreement/view",PublicServer]]]];
    }else if (self.type == WebTypeIntegralRule){
        self.title = @"积分规则";
        [web loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/member/total/view",PublicServer]]]];
    }else if (self.type == WebTypeCreate){
        self.title = @"人脉介绍";
        [web loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/group",PublicServer]]]];
    }else if (self.type == WebTypeAdd){
        self.title = @"名片扫一扫";
        [web loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/add",PublicServer]]]];
    }else if (self.type == WebTypeResource){
        self.title = @"附近合伙人";
        [web loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/resource",PublicServer]]]];
    }
}

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    [self showClearBgWaiter];
    return YES;
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [self hideWaiter];
}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    [self hideWaiter];
}
@end
